#! /usr/bin/env python
# -*- coding: utf-8 -*-

import rospy
from std_msgs.msg import String, Bool
import os

def start_cb(data):
    global flag
    if data.data == True:
        os.system("mplayer /home/tcr/agv_ws/src/xfei_asr/src/wav/test.wav")
        finish_application.publish(True)

if __name__ == '__main__':
    try:
        rospy.Rate = 10
        rospy.init_node("nav_speak",anonymous=True)
        xfwords = rospy.Publisher("xfwords", String, queue_size=5)
        start_application = rospy.Subscriber("start_application", Bool, start_cb)
        finish_application = rospy.Publisher("finish_application", Bool, queue_size=5)

        rospy.spin()
    except rospy.ROSInterruptException:
        rospy.loginfo("InterruptException.")
